<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.param.service.impl.PropertyServiceImpl" %>
<%@ page import="net.comm.common.ReturnMessage" %>
<%@ page import="net.comm.param.web.form.PropertyForm" %>
<%@ page import="net.comm.page.PageCtr" %>
<%@ page import="net.comm.param.bean.BaseProperty" %>
<%@ page import="java.util.List" %>

<% 

		try {
			request.setCharacterEncoding("UTF-8"); 
			response.setCharacterEncoding("UTF-8"); 
		} catch (Exception e) {
			e.printStackTrace();
		}
		//不缓存页面
		response.setHeader("Cache-Control","no-store");
		response.setHeader("Pragrma","no-cache");
		response.setDateHeader("Expires",0);

		String strParentID = request.getParameter("parentID");

		int iAssortID = Integer.valueOf(request.getParameter("assortID"));
		int iParentID = 0;
		if((strParentID != null)&&(strParentID != "")){
			iParentID = Integer.valueOf(strParentID);
		}

		int ret = 0;

		StringBuffer sb = new StringBuffer(); 
		response.addHeader("Content-Type","text/html"); 
		
		sb.append("<option value='0'>请选择</option>");

		ReturnMessage msg  = new ReturnMessage();
		PropertyForm theForm = new PropertyForm();
		PropertyServiceImpl service = new PropertyServiceImpl();
		PageCtr pagectr = new PageCtr(1, 400, "N", " 1=1 ");
				
		//查询条件
		theForm.setQryAssortID(iAssortID);

		if(iParentID > 0 ){
				theForm.setQryParentID(iParentID);
		}
		theForm.setPage(pagectr);


		List list = service.adlist(theForm, msg);

		if(list.size() > 0){

			int len = list.size();
			BaseProperty base = new BaseProperty();

			for(int i=0; i < len; i++){
				base = (BaseProperty)list.get(i);
				sb.append("<option value=" + String.valueOf(base.getPropID()) + " >"); 
				sb.append( base.getPropname() + "</option>");

			}
		}

		if(ret == 0)
		{
			//服务器返回给login.jsp的response
		}else if(ret == 1)
		{
           sb.append("获取数据库连接错误！");    
		   //服务器返回给login.jsp的response
		}
		
//		System.out.println("s="+ sb.toString());

		response.getWriter().write(sb.toString()); 
		
 %>       
